/*
 * Copyright @ 苏州瑞云信息技术有限公司 All rights reserved.
 */
package cn.com.recloud.bbs.controller;


import cn.com.recloud.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import cn.com.recloud.one.spring.controller.BaseController;

import cn.com.recloud.bbs.entity.bbs_my_article_type;
import cn.com.recloud.bbs.service.MyArticleTypeService;

import java.util.List;
import java.util.Map;

/**
 * @author kim dong
 * @date 2020-04-28
 */
@RestController
@RequestMapping("/api/bbs/myarticletype")
@Api(tags = "我的文章类型")
public class MyArticleTypeController extends BaseController<bbs_my_article_type, MyArticleTypeService> {
    @Autowired
    private MyArticleTypeService typeService;

    @PostMapping("getalltype")
    @ApiOperation("获取所有文章类型")
    public Result getAllType() {
        Map map = typeService.selectAllType();
        return new Result(map);
    }

    @PostMapping("savetype")
    @ApiOperation("保存文章类型")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "包含分类的id和排序map对象")
    })
    public Result saveListType(@RequestBody List<Map> type) {
        typeService.saveListType(type);
        return Result.SUCCESS;

    }
}

